3.1.84 \(\int \frac {(a+b \tan (e+f x))^3 (A+B \tan (e+f x)+C \tan ^2(e+f x))}{(c+d \tan (e+f x))^3} \, dx\) [84]

3.1.84.1 Optimal result
3.1.84.2 Mathematica [C] (verified)
3.1.84.3 Rubi [A] (verified)
3.1.84.4 Maple [A] (verified)
3.1.84.5 Fricas [B] (verification not implemented)
3.1.84.6 Sympy [F(-2)]
3.1.84.7 Maxima [A] (verification not implemented)
3.1.84.8 Giac [B] (verification not implemented)
3.1.84.9 Mupad [B] (verification not implemented)

3.1.84.1 Optimal result

Integrand size = 45, antiderivative size = 804 \[ \int \frac {(a+b \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^3} \, dx=-\frac {\left (3 a b^2 \left (A c^3-c^3 C+3 B c^2 d-3 A c d^2+3 c C d^2-B d^3\right )+a^3 \left (c^3 C-3 B c^2 d-3 c C d^2+B d^3-A \left (c^3-3 c d^2\right )\right )-3 a^2 b \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right )+b^3 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right )\right ) x}{\left (c^2+d^2\right )^3}-\frac {\left (3 a^2 b \left (A c^3-c^3 C+3 B c^2 d-3 A c d^2+3 c C d^2-B d^3\right )-b^3 \left (A c^3-c^3 C+3 B c^2 d-3 A c d^2+3 c C d^2-B d^3\right )-a^3 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right )+3 a b^2 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right )\right ) \log (\cos (e+f x))}{\left (c^2+d^2\right )^3 f}-\frac {(b c-a d) \left (b^2 \left (3 c^6 C-B c^5 d+9 c^4 C d^2-3 B c^3 d^3-c^2 (A-10 C) d^4-6 B c d^5+3 A d^6\right )+a^2 d^3 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right )+a b d^2 \left (8 c (A-C) d^3-B \left (c^4+6 c^2 d^2-3 d^4\right )\right )\right ) \log (c+d \tan (e+f x))}{d^4 \left (c^2+d^2\right )^3 f}+\frac {b^2 \left (b \left (3 c^4 C-B c^3 d+6 c^2 C d^2-3 B c d^3+(2 A+C) d^4\right )+a d^2 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right ) \tan (e+f x)}{d^3 \left (c^2+d^2\right )^2 f}-\frac {\left (c^2 C-B c d+A d^2\right ) (a+b \tan (e+f x))^3}{2 d \left (c^2+d^2\right ) f (c+d \tan (e+f x))^2}-\frac {\left (b \left (3 c^4 C-B c^3 d-c^2 (A-7 C) d^2-5 B c d^3+3 A d^4\right )+2 a d^2 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right ) (a+b \tan (e+f x))^2}{2 d^2 \left (c^2+d^2\right )^2 f (c+d \tan (e+f x))} \]

output
-(3*a*b^2*(A*c^3-3*A*c*d^2+3*B*c^2*d-B*d^3-C*c^3+3*C*c*d^2)+a^3*(c^3*C-3*B 
*c^2*d-3*C*c*d^2+B*d^3-A*(c^3-3*c*d^2))-3*a^2*b*((A-C)*d*(3*c^2-d^2)-B*(c^ 
3-3*c*d^2))+b^3*((A-C)*d*(3*c^2-d^2)-B*(c^3-3*c*d^2)))*x/(c^2+d^2)^3-(3*a^ 
2*b*(A*c^3-3*A*c*d^2+3*B*c^2*d-B*d^3-C*c^3+3*C*c*d^2)-b^3*(A*c^3-3*A*c*d^2 
+3*B*c^2*d-B*d^3-C*c^3+3*C*c*d^2)-a^3*((A-C)*d*(3*c^2-d^2)-B*(c^3-3*c*d^2) 
)+3*a*b^2*((A-C)*d*(3*c^2-d^2)-B*(c^3-3*c*d^2)))*ln(cos(f*x+e))/(c^2+d^2)^ 
3/f-(-a*d+b*c)*(b^2*(3*c^6*C-B*c^5*d+9*c^4*C*d^2-3*B*c^3*d^3-c^2*(A-10*C)* 
d^4-6*B*c*d^5+3*A*d^6)+a^2*d^3*((A-C)*d*(3*c^2-d^2)-B*(c^3-3*c*d^2))+a*b*d 
^2*(8*c*(A-C)*d^3-B*(c^4+6*c^2*d^2-3*d^4)))*ln(c+d*tan(f*x+e))/d^4/(c^2+d^ 
2)^3/f+b^2*(b*(3*c^4*C-B*c^3*d+6*C*c^2*d^2-3*B*c*d^3+(2*A+C)*d^4)+a*d^2*(2 
*c*(A-C)*d-B*(c^2-d^2)))*tan(f*x+e)/d^3/(c^2+d^2)^2/f-1/2*(A*d^2-B*c*d+C*c 
^2)*(a+b*tan(f*x+e))^3/d/(c^2+d^2)/f/(c+d*tan(f*x+e))^2-1/2*(b*(3*c^4*C-B* 
c^3*d-c^2*(A-7*C)*d^2-5*B*c*d^3+3*A*d^4)+2*a*d^2*(2*c*(A-C)*d-B*(c^2-d^2)) 
)*(a+b*tan(f*x+e))^2/d^2/(c^2+d^2)^2/f/(c+d*tan(f*x+e))
 
3.1.84.2 Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 7.37 (sec) , antiderivative size = 454, normalized size of antiderivative = 0.56 \[ \int \frac {(a+b \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^3} \, dx=\frac {\frac {(a+i b)^3 (A+i B-C) \log (i-\tan (e+f x))}{(-i c+d)^3}+\frac {(a-i b)^3 (A-i B-C) \log (i+\tan (e+f x))}{(i c+d)^3}+\frac {2 (-b c+a d) \left (b^2 \left (3 c^6 C-B c^5 d+9 c^4 C d^2-3 B c^3 d^3-c^2 (A-10 C) d^4-6 B c d^5+3 A d^6\right )+a^2 d^3 \left (-\left ((A-C) d \left (-3 c^2+d^2\right )\right )-B \left (c^3-3 c d^2\right )\right )-a b d^2 \left (8 c (-A+C) d^3+B \left (c^4+6 c^2 d^2-3 d^4\right )\right )\right ) \log (c+d \tan (e+f x))}{d^4 \left (c^2+d^2\right )^3}+\frac {(b c-a d)^3 \left (3 c^2 C-B c d+(A+2 C) d^2\right )}{d^4 \left (c^2+d^2\right ) (c+d \tan (e+f x))^2}+\frac {2 C (a+b \tan (e+f x))^3}{d (c+d \tan (e+f x))^2}-\frac {2 (b c-a d)^2 \left (b \left (6 c^4 C-2 B c^3 d+c^2 (A+11 C) d^2-4 B c d^3+3 (A+C) d^4\right )+a d^2 \left (2 c (A-C) d+B \left (-c^2+d^2\right )\right )\right )}{d^4 \left (c^2+d^2\right )^2 (c+d \tan (e+f x))}}{2 f} \]

input
Integrate[((a + b*Tan[e + f*x])^3*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2)) 
/(c + d*Tan[e + f*x])^3,x]
 
output
(((a + I*b)^3*(A + I*B - C)*Log[I - Tan[e + f*x]])/((-I)*c + d)^3 + ((a - 
I*b)^3*(A - I*B - C)*Log[I + Tan[e + f*x]])/(I*c + d)^3 + (2*(-(b*c) + a*d 
)*(b^2*(3*c^6*C - B*c^5*d + 9*c^4*C*d^2 - 3*B*c^3*d^3 - c^2*(A - 10*C)*d^4 
 - 6*B*c*d^5 + 3*A*d^6) + a^2*d^3*(-((A - C)*d*(-3*c^2 + d^2)) - B*(c^3 - 
3*c*d^2)) - a*b*d^2*(8*c*(-A + C)*d^3 + B*(c^4 + 6*c^2*d^2 - 3*d^4)))*Log[ 
c + d*Tan[e + f*x]])/(d^4*(c^2 + d^2)^3) + ((b*c - a*d)^3*(3*c^2*C - B*c*d 
 + (A + 2*C)*d^2))/(d^4*(c^2 + d^2)*(c + d*Tan[e + f*x])^2) + (2*C*(a + b* 
Tan[e + f*x])^3)/(d*(c + d*Tan[e + f*x])^2) - (2*(b*c - a*d)^2*(b*(6*c^4*C 
 - 2*B*c^3*d + c^2*(A + 11*C)*d^2 - 4*B*c*d^3 + 3*(A + C)*d^4) + a*d^2*(2* 
c*(A - C)*d + B*(-c^2 + d^2))))/(d^4*(c^2 + d^2)^2*(c + d*Tan[e + f*x])))/ 
(2*f)
 
3.1.84.3 Rubi [A] (verified)

Time = 4.00 (sec) , antiderivative size = 837, normalized size of antiderivative = 1.04, number of steps used = 14, number of rules used = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.289, Rules used = {3042, 4128, 3042, 4128, 3042, 4120, 27, 3042, 4109, 3042, 3956, 4100, 16}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {(a+b \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^3} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(a+b \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan (e+f x)^2\right )}{(c+d \tan (e+f x))^3}dx\)

\(\Big \downarrow \) 4128

\(\displaystyle \frac {\int \frac {(a+b \tan (e+f x))^2 \left (b \left (3 C c^2-B d c+(A+2 C) d^2\right ) \tan ^2(e+f x)+2 d ((A-C) (b c-a d)+B (a c+b d)) \tan (e+f x)+A d (2 a c+3 b d)+(3 b c-2 a d) (c C-B d)\right )}{(c+d \tan (e+f x))^2}dx}{2 d \left (c^2+d^2\right )}-\frac {\left (A d^2-B c d+c^2 C\right ) (a+b \tan (e+f x))^3}{2 d f \left (c^2+d^2\right ) (c+d \tan (e+f x))^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \frac {(a+b \tan (e+f x))^2 \left (b \left (3 C c^2-B d c+(A+2 C) d^2\right ) \tan (e+f x)^2+2 d ((A-C) (b c-a d)+B (a c+b d)) \tan (e+f x)+A d (2 a c+3 b d)+(3 b c-2 a d) (c C-B d)\right )}{(c+d \tan (e+f x))^2}dx}{2 d \left (c^2+d^2\right )}-\frac {\left (A d^2-B c d+c^2 C\right ) (a+b \tan (e+f x))^3}{2 d f \left (c^2+d^2\right ) (c+d \tan (e+f x))^2}\)

\(\Big \downarrow \) 4128

\(\displaystyle \frac {\frac {\int \frac {(a+b \tan (e+f x)) \left (2 ((a c+b d) ((A-C) (b c-a d)+B (a c+b d))-(b c-a d) (b B c-b (A-C) d-a (A c-C c+B d))) \tan (e+f x) d^2+(a c+2 b d) (A d (2 a c+3 b d)+(3 b c-2 a d) (c C-B d)) d+2 b \left (a \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) d^2+b \left (3 C c^4-B d c^3+6 C d^2 c^2-3 B d^3 c+(2 A+C) d^4\right )\right ) \tan ^2(e+f x)-(2 b c-a d) \left (2 a d^2 (B c-(A-C) d)-b \left (3 C c^3-B d c^2-(A-4 C) d^2 c-2 B d^3\right )\right )\right )}{c+d \tan (e+f x)}dx}{d \left (c^2+d^2\right )}-\frac {(a+b \tan (e+f x))^2 \left (2 a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (-c^2 d^2 (A-7 C)+3 A d^4-B c^3 d-5 B c d^3+3 c^4 C\right )\right )}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}}{2 d \left (c^2+d^2\right )}-\frac {\left (A d^2-B c d+c^2 C\right ) (a+b \tan (e+f x))^3}{2 d f \left (c^2+d^2\right ) (c+d \tan (e+f x))^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {\int \frac {(a+b \tan (e+f x)) \left (2 ((a c+b d) ((A-C) (b c-a d)+B (a c+b d))-(b c-a d) (b B c-b (A-C) d-a (A c-C c+B d))) \tan (e+f x) d^2+(a c+2 b d) (A d (2 a c+3 b d)+(3 b c-2 a d) (c C-B d)) d+2 b \left (a \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) d^2+b \left (3 C c^4-B d c^3+6 C d^2 c^2-3 B d^3 c+(2 A+C) d^4\right )\right ) \tan (e+f x)^2-(2 b c-a d) \left (2 a d^2 (B c-(A-C) d)-b \left (3 C c^3-B d c^2-(A-4 C) d^2 c-2 B d^3\right )\right )\right )}{c+d \tan (e+f x)}dx}{d \left (c^2+d^2\right )}-\frac {(a+b \tan (e+f x))^2 \left (2 a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (-c^2 d^2 (A-7 C)+3 A d^4-B c^3 d-5 B c d^3+3 c^4 C\right )\right )}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}}{2 d \left (c^2+d^2\right )}-\frac {\left (A d^2-B c d+c^2 C\right ) (a+b \tan (e+f x))^3}{2 d f \left (c^2+d^2\right ) (c+d \tan (e+f x))^2}\)

\(\Big \downarrow \) 4120

\(\displaystyle \frac {\frac {\frac {2 b^2 \tan (e+f x) \left (a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (d^4 (2 A+C)-B c^3 d-3 B c d^3+3 c^4 C+6 c^2 C d^2\right )\right )}{d f}-\frac {\int -\frac {2 \left (-c \left (3 C c^4-B d c^3+6 C d^2 c^2-3 B d^3 c+(2 A+C) d^4\right ) b^3-(3 b c C-3 a d C-b B d) \left (c^2+d^2\right )^2 \tan ^2(e+f x) b^2+3 a d \left (C c^4-(A-3 C) d^2 c^2-2 B d^3 c+A d^4\right ) b^2+3 a^2 d^3 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) b-a^3 d^3 \left (C c^2-2 B d c-C d^2-A \left (c^2-d^2\right )\right )-d^3 \left (\left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) a^3+3 b \left (C c^2-2 B d c-C d^2-A \left (c^2-d^2\right )\right ) a^2-3 b^2 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) a-b^3 \left (C c^2-2 B d c-C d^2-A \left (c^2-d^2\right )\right )\right ) \tan (e+f x)\right )}{c+d \tan (e+f x)}dx}{d}}{d \left (c^2+d^2\right )}-\frac {(a+b \tan (e+f x))^2 \left (2 a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (-c^2 d^2 (A-7 C)+3 A d^4-B c^3 d-5 B c d^3+3 c^4 C\right )\right )}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}}{2 d \left (c^2+d^2\right )}-\frac {\left (A d^2-B c d+c^2 C\right ) (a+b \tan (e+f x))^3}{2 d f \left (c^2+d^2\right ) (c+d \tan (e+f x))^2}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {\frac {\frac {2 \int \frac {-c \left (3 C c^4-B d c^3+6 C d^2 c^2-3 B d^3 c+(2 A+C) d^4\right ) b^3-(3 b c C-3 a d C-b B d) \left (c^2+d^2\right )^2 \tan ^2(e+f x) b^2+3 a d \left (C c^4-(A-3 C) d^2 c^2-2 B d^3 c+A d^4\right ) b^2+3 a^2 d^3 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) b-a^3 d^3 \left (C c^2-2 B d c-C d^2-A \left (c^2-d^2\right )\right )-d^3 \left (\left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) a^3+3 b \left (C c^2-2 B d c-C d^2-A \left (c^2-d^2\right )\right ) a^2-3 b^2 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) a-b^3 \left (C c^2-2 B d c-C d^2-A \left (c^2-d^2\right )\right )\right ) \tan (e+f x)}{c+d \tan (e+f x)}dx}{d}+\frac {2 b^2 \tan (e+f x) \left (a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (d^4 (2 A+C)-B c^3 d-3 B c d^3+3 c^4 C+6 c^2 C d^2\right )\right )}{d f}}{d \left (c^2+d^2\right )}-\frac {(a+b \tan (e+f x))^2 \left (2 a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (-c^2 d^2 (A-7 C)+3 A d^4-B c^3 d-5 B c d^3+3 c^4 C\right )\right )}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}}{2 d \left (c^2+d^2\right )}-\frac {\left (A d^2-B c d+c^2 C\right ) (a+b \tan (e+f x))^3}{2 d f \left (c^2+d^2\right ) (c+d \tan (e+f x))^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {\frac {2 \int \frac {-c \left (3 C c^4-B d c^3+6 C d^2 c^2-3 B d^3 c+(2 A+C) d^4\right ) b^3-(3 b c C-3 a d C-b B d) \left (c^2+d^2\right )^2 \tan (e+f x)^2 b^2+3 a d \left (C c^4-(A-3 C) d^2 c^2-2 B d^3 c+A d^4\right ) b^2+3 a^2 d^3 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) b-a^3 d^3 \left (C c^2-2 B d c-C d^2-A \left (c^2-d^2\right )\right )-d^3 \left (\left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) a^3+3 b \left (C c^2-2 B d c-C d^2-A \left (c^2-d^2\right )\right ) a^2-3 b^2 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) a-b^3 \left (C c^2-2 B d c-C d^2-A \left (c^2-d^2\right )\right )\right ) \tan (e+f x)}{c+d \tan (e+f x)}dx}{d}+\frac {2 b^2 \tan (e+f x) \left (a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (d^4 (2 A+C)-B c^3 d-3 B c d^3+3 c^4 C+6 c^2 C d^2\right )\right )}{d f}}{d \left (c^2+d^2\right )}-\frac {(a+b \tan (e+f x))^2 \left (2 a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (-c^2 d^2 (A-7 C)+3 A d^4-B c^3 d-5 B c d^3+3 c^4 C\right )\right )}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}}{2 d \left (c^2+d^2\right )}-\frac {\left (A d^2-B c d+c^2 C\right ) (a+b \tan (e+f x))^3}{2 d f \left (c^2+d^2\right ) (c+d \tan (e+f x))^2}\)

\(\Big \downarrow \) 4109

\(\displaystyle \frac {\frac {\frac {2 \left (a \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) d^2+b \left (3 C c^4-B d c^3+6 C d^2 c^2-3 B d^3 c+(2 A+C) d^4\right )\right ) \tan (e+f x) b^2}{d f}+\frac {2 \left (-\frac {\left (\left (C c^3-3 B d c^2-3 C d^2 c+B d^3-A \left (c^3-3 c d^2\right )\right ) a^3-3 b \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) a^2+3 b^2 \left (A c^3-C c^3+3 B d c^2-3 A d^2 c+3 C d^2 c-B d^3\right ) a+b^3 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right )\right ) x d^3}{c^2+d^2}+\frac {\left (-\left (\left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) a^3\right )+3 b \left (A c^3-C c^3+3 B d c^2-3 A d^2 c+3 C d^2 c-B d^3\right ) a^2+3 b^2 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) a-b^3 \left (A c^3-C c^3+3 B d c^2-3 A d^2 c+3 C d^2 c-B d^3\right )\right ) \int \tan (e+f x)dx d^3}{c^2+d^2}-\frac {(b c-a d) \left (a^2 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) d^3+a b \left (8 c (A-C) d^3-B \left (c^4+6 d^2 c^2-3 d^4\right )\right ) d^2+b^2 \left (3 C c^6-B d c^5+9 C d^2 c^4-3 B d^3 c^3-(A-10 C) d^4 c^2-6 B d^5 c+3 A d^6\right )\right ) \int \frac {\tan ^2(e+f x)+1}{c+d \tan (e+f x)}dx}{c^2+d^2}\right )}{d}}{d \left (c^2+d^2\right )}-\frac {\left (2 a \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) d^2+b \left (3 C c^4-B d c^3-(A-7 C) d^2 c^2-5 B d^3 c+3 A d^4\right )\right ) (a+b \tan (e+f x))^2}{d \left (c^2+d^2\right ) f (c+d \tan (e+f x))}}{2 d \left (c^2+d^2\right )}-\frac {\left (C c^2-B d c+A d^2\right ) (a+b \tan (e+f x))^3}{2 d \left (c^2+d^2\right ) f (c+d \tan (e+f x))^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {\frac {2 \left (a \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) d^2+b \left (3 C c^4-B d c^3+6 C d^2 c^2-3 B d^3 c+(2 A+C) d^4\right )\right ) \tan (e+f x) b^2}{d f}+\frac {2 \left (-\frac {\left (\left (C c^3-3 B d c^2-3 C d^2 c+B d^3-A \left (c^3-3 c d^2\right )\right ) a^3-3 b \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) a^2+3 b^2 \left (A c^3-C c^3+3 B d c^2-3 A d^2 c+3 C d^2 c-B d^3\right ) a+b^3 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right )\right ) x d^3}{c^2+d^2}+\frac {\left (-\left (\left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) a^3\right )+3 b \left (A c^3-C c^3+3 B d c^2-3 A d^2 c+3 C d^2 c-B d^3\right ) a^2+3 b^2 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) a-b^3 \left (A c^3-C c^3+3 B d c^2-3 A d^2 c+3 C d^2 c-B d^3\right )\right ) \int \tan (e+f x)dx d^3}{c^2+d^2}-\frac {(b c-a d) \left (a^2 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) d^3+a b \left (8 c (A-C) d^3-B \left (c^4+6 d^2 c^2-3 d^4\right )\right ) d^2+b^2 \left (3 C c^6-B d c^5+9 C d^2 c^4-3 B d^3 c^3-(A-10 C) d^4 c^2-6 B d^5 c+3 A d^6\right )\right ) \int \frac {\tan (e+f x)^2+1}{c+d \tan (e+f x)}dx}{c^2+d^2}\right )}{d}}{d \left (c^2+d^2\right )}-\frac {\left (2 a \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) d^2+b \left (3 C c^4-B d c^3-(A-7 C) d^2 c^2-5 B d^3 c+3 A d^4\right )\right ) (a+b \tan (e+f x))^2}{d \left (c^2+d^2\right ) f (c+d \tan (e+f x))}}{2 d \left (c^2+d^2\right )}-\frac {\left (C c^2-B d c+A d^2\right ) (a+b \tan (e+f x))^3}{2 d \left (c^2+d^2\right ) f (c+d \tan (e+f x))^2}\)

\(\Big \downarrow \) 3956

\(\displaystyle \frac {\frac {\frac {2 \left (a \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) d^2+b \left (3 C c^4-B d c^3+6 C d^2 c^2-3 B d^3 c+(2 A+C) d^4\right )\right ) \tan (e+f x) b^2}{d f}+\frac {2 \left (-\frac {\left (\left (C c^3-3 B d c^2-3 C d^2 c+B d^3-A \left (c^3-3 c d^2\right )\right ) a^3-3 b \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) a^2+3 b^2 \left (A c^3-C c^3+3 B d c^2-3 A d^2 c+3 C d^2 c-B d^3\right ) a+b^3 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right )\right ) x d^3}{c^2+d^2}-\frac {\left (-\left (\left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) a^3\right )+3 b \left (A c^3-C c^3+3 B d c^2-3 A d^2 c+3 C d^2 c-B d^3\right ) a^2+3 b^2 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) a-b^3 \left (A c^3-C c^3+3 B d c^2-3 A d^2 c+3 C d^2 c-B d^3\right )\right ) \log (\cos (e+f x)) d^3}{\left (c^2+d^2\right ) f}-\frac {(b c-a d) \left (a^2 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) d^3+a b \left (8 c (A-C) d^3-B \left (c^4+6 d^2 c^2-3 d^4\right )\right ) d^2+b^2 \left (3 C c^6-B d c^5+9 C d^2 c^4-3 B d^3 c^3-(A-10 C) d^4 c^2-6 B d^5 c+3 A d^6\right )\right ) \int \frac {\tan (e+f x)^2+1}{c+d \tan (e+f x)}dx}{c^2+d^2}\right )}{d}}{d \left (c^2+d^2\right )}-\frac {\left (2 a \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) d^2+b \left (3 C c^4-B d c^3-(A-7 C) d^2 c^2-5 B d^3 c+3 A d^4\right )\right ) (a+b \tan (e+f x))^2}{d \left (c^2+d^2\right ) f (c+d \tan (e+f x))}}{2 d \left (c^2+d^2\right )}-\frac {\left (C c^2-B d c+A d^2\right ) (a+b \tan (e+f x))^3}{2 d \left (c^2+d^2\right ) f (c+d \tan (e+f x))^2}\)

\(\Big \downarrow \) 4100

\(\displaystyle \frac {\frac {\frac {2 \left (a \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) d^2+b \left (3 C c^4-B d c^3+6 C d^2 c^2-3 B d^3 c+(2 A+C) d^4\right )\right ) \tan (e+f x) b^2}{d f}+\frac {2 \left (-\frac {\left (\left (C c^3-3 B d c^2-3 C d^2 c+B d^3-A \left (c^3-3 c d^2\right )\right ) a^3-3 b \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) a^2+3 b^2 \left (A c^3-C c^3+3 B d c^2-3 A d^2 c+3 C d^2 c-B d^3\right ) a+b^3 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right )\right ) x d^3}{c^2+d^2}-\frac {\left (-\left (\left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) a^3\right )+3 b \left (A c^3-C c^3+3 B d c^2-3 A d^2 c+3 C d^2 c-B d^3\right ) a^2+3 b^2 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) a-b^3 \left (A c^3-C c^3+3 B d c^2-3 A d^2 c+3 C d^2 c-B d^3\right )\right ) \log (\cos (e+f x)) d^3}{\left (c^2+d^2\right ) f}-\frac {(b c-a d) \left (a^2 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) d^3+a b \left (8 c (A-C) d^3-B \left (c^4+6 d^2 c^2-3 d^4\right )\right ) d^2+b^2 \left (3 C c^6-B d c^5+9 C d^2 c^4-3 B d^3 c^3-(A-10 C) d^4 c^2-6 B d^5 c+3 A d^6\right )\right ) \int \frac {1}{c+d \tan (e+f x)}d(d \tan (e+f x))}{\left (c^2+d^2\right ) f d}\right )}{d}}{d \left (c^2+d^2\right )}-\frac {\left (2 a \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) d^2+b \left (3 C c^4-B d c^3-(A-7 C) d^2 c^2-5 B d^3 c+3 A d^4\right )\right ) (a+b \tan (e+f x))^2}{d \left (c^2+d^2\right ) f (c+d \tan (e+f x))}}{2 d \left (c^2+d^2\right )}-\frac {\left (C c^2-B d c+A d^2\right ) (a+b \tan (e+f x))^3}{2 d \left (c^2+d^2\right ) f (c+d \tan (e+f x))^2}\)

\(\Big \downarrow \) 16

\(\displaystyle \frac {\frac {\frac {2 \left (a \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) d^2+b \left (3 C c^4-B d c^3+6 C d^2 c^2-3 B d^3 c+(2 A+C) d^4\right )\right ) \tan (e+f x) b^2}{d f}+\frac {2 \left (-\frac {\left (\left (C c^3-3 B d c^2-3 C d^2 c+B d^3-A \left (c^3-3 c d^2\right )\right ) a^3-3 b \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) a^2+3 b^2 \left (A c^3-C c^3+3 B d c^2-3 A d^2 c+3 C d^2 c-B d^3\right ) a+b^3 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right )\right ) x d^3}{c^2+d^2}-\frac {\left (-\left (\left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) a^3\right )+3 b \left (A c^3-C c^3+3 B d c^2-3 A d^2 c+3 C d^2 c-B d^3\right ) a^2+3 b^2 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) a-b^3 \left (A c^3-C c^3+3 B d c^2-3 A d^2 c+3 C d^2 c-B d^3\right )\right ) \log (\cos (e+f x)) d^3}{\left (c^2+d^2\right ) f}-\frac {(b c-a d) \left (a^2 \left ((A-C) d \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right ) d^3+a b \left (8 c (A-C) d^3-B \left (c^4+6 d^2 c^2-3 d^4\right )\right ) d^2+b^2 \left (3 C c^6-B d c^5+9 C d^2 c^4-3 B d^3 c^3-(A-10 C) d^4 c^2-6 B d^5 c+3 A d^6\right )\right ) \log (c+d \tan (e+f x))}{\left (c^2+d^2\right ) f d}\right )}{d}}{d \left (c^2+d^2\right )}-\frac {\left (2 a \left (2 c (A-C) d-B \left (c^2-d^2\right )\right ) d^2+b \left (3 C c^4-B d c^3-(A-7 C) d^2 c^2-5 B d^3 c+3 A d^4\right )\right ) (a+b \tan (e+f x))^2}{d \left (c^2+d^2\right ) f (c+d \tan (e+f x))}}{2 d \left (c^2+d^2\right )}-\frac {\left (C c^2-B d c+A d^2\right ) (a+b \tan (e+f x))^3}{2 d \left (c^2+d^2\right ) f (c+d \tan (e+f x))^2}\)

input
Int[((a + b*Tan[e + f*x])^3*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(c + 
d*Tan[e + f*x])^3,x]
 
output
-1/2*((c^2*C - B*c*d + A*d^2)*(a + b*Tan[e + f*x])^3)/(d*(c^2 + d^2)*f*(c 
+ d*Tan[e + f*x])^2) + (-(((b*(3*c^4*C - B*c^3*d - c^2*(A - 7*C)*d^2 - 5*B 
*c*d^3 + 3*A*d^4) + 2*a*d^2*(2*c*(A - C)*d - B*(c^2 - d^2)))*(a + b*Tan[e 
+ f*x])^2)/(d*(c^2 + d^2)*f*(c + d*Tan[e + f*x]))) + ((2*(-((d^3*(3*a*b^2* 
(A*c^3 - c^3*C + 3*B*c^2*d - 3*A*c*d^2 + 3*c*C*d^2 - B*d^3) + a^3*(c^3*C - 
 3*B*c^2*d - 3*c*C*d^2 + B*d^3 - A*(c^3 - 3*c*d^2)) - 3*a^2*b*((A - C)*d*( 
3*c^2 - d^2) - B*(c^3 - 3*c*d^2)) + b^3*((A - C)*d*(3*c^2 - d^2) - B*(c^3 
- 3*c*d^2)))*x)/(c^2 + d^2)) - (d^3*(3*a^2*b*(A*c^3 - c^3*C + 3*B*c^2*d - 
3*A*c*d^2 + 3*c*C*d^2 - B*d^3) - b^3*(A*c^3 - c^3*C + 3*B*c^2*d - 3*A*c*d^ 
2 + 3*c*C*d^2 - B*d^3) - a^3*((A - C)*d*(3*c^2 - d^2) - B*(c^3 - 3*c*d^2)) 
 + 3*a*b^2*((A - C)*d*(3*c^2 - d^2) - B*(c^3 - 3*c*d^2)))*Log[Cos[e + f*x] 
])/((c^2 + d^2)*f) - ((b*c - a*d)*(b^2*(3*c^6*C - B*c^5*d + 9*c^4*C*d^2 - 
3*B*c^3*d^3 - c^2*(A - 10*C)*d^4 - 6*B*c*d^5 + 3*A*d^6) + a^2*d^3*((A - C) 
*d*(3*c^2 - d^2) - B*(c^3 - 3*c*d^2)) + a*b*d^2*(8*c*(A - C)*d^3 - B*(c^4 
+ 6*c^2*d^2 - 3*d^4)))*Log[c + d*Tan[e + f*x]])/(d*(c^2 + d^2)*f)))/d + (2 
*b^2*(b*(3*c^4*C - B*c^3*d + 6*c^2*C*d^2 - 3*B*c*d^3 + (2*A + C)*d^4) + a* 
d^2*(2*c*(A - C)*d - B*(c^2 - d^2)))*Tan[e + f*x])/(d*f))/(d*(c^2 + d^2))) 
/(2*d*(c^2 + d^2))
 

3.1.84.3.1 Defintions of rubi rules used

rule 16
Int[(c_.)/((a_.) + (b_.)*(x_)), x_Symbol] :> Simp[c*(Log[RemoveContent[a + 
b*x, x]]/b), x] /; FreeQ[{a, b, c}, x]
 

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3956
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d 
*x], x]]/d, x] /; FreeQ[{c, d}, x]
 

rule 4100
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_) + (C_.)*tan[(e_.) + 
 (f_.)*(x_)]^2), x_Symbol] :> Simp[A/(b*f)   Subst[Int[(a + x)^m, x], x, b* 
Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, A, C, m}, x] && EqQ[A, C]
 

rule 4109
Int[((A_) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2 
)/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*A + b*B - a 
*C)*(x/(a^2 + b^2)), x] + (Simp[(A*b^2 - a*b*B + a^2*C)/(a^2 + b^2)   Int[( 
1 + Tan[e + f*x]^2)/(a + b*Tan[e + f*x]), x], x] - Simp[(A*b - a*B - b*C)/( 
a^2 + b^2)   Int[Tan[e + f*x], x], x]) /; FreeQ[{a, b, e, f, A, B, C}, x] & 
& NeQ[A*b^2 - a*b*B + a^2*C, 0] && NeQ[a^2 + b^2, 0] && NeQ[A*b - a*B - b*C 
, 0]
 

rule 4120
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.) 
*(x_)])^(n_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f 
_.)*(x_)]^2), x_Symbol] :> Simp[b*C*Tan[e + f*x]*((c + d*Tan[e + f*x])^(n + 
 1)/(d*f*(n + 2))), x] - Simp[1/(d*(n + 2))   Int[(c + d*Tan[e + f*x])^n*Si 
mp[b*c*C - a*A*d*(n + 2) - (A*b + a*B - b*C)*d*(n + 2)*Tan[e + f*x] - (a*C* 
d*(n + 2) - b*(c*C - B*d*(n + 2)))*Tan[e + f*x]^2, x], x], x] /; FreeQ[{a, 
b, c, d, e, f, A, B, C, n}, x] && NeQ[b*c - a*d, 0] && NeQ[c^2 + d^2, 0] && 
  !LtQ[n, -1]
 

rule 4128
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)])^(n_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) 
 + (f_.)*(x_)]^2), x_Symbol] :> Simp[(A*d^2 + c*(c*C - B*d))*(a + b*Tan[e + 
 f*x])^m*((c + d*Tan[e + f*x])^(n + 1)/(d*f*(n + 1)*(c^2 + d^2))), x] - Sim 
p[1/(d*(n + 1)*(c^2 + d^2))   Int[(a + b*Tan[e + f*x])^(m - 1)*(c + d*Tan[e 
 + f*x])^(n + 1)*Simp[A*d*(b*d*m - a*c*(n + 1)) + (c*C - B*d)*(b*c*m + a*d* 
(n + 1)) - d*(n + 1)*((A - C)*(b*c - a*d) + B*(a*c + b*d))*Tan[e + f*x] - b 
*(d*(B*c - A*d)*(m + n + 1) - C*(c^2*m - d^2*(n + 1)))*Tan[e + f*x]^2, x], 
x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C}, x] && NeQ[b*c - a*d, 0] && NeQ 
[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && GtQ[m, 0] && LtQ[n, -1]
 
3.1.84.4 Maple [A] (verified)

Time = 0.58 (sec) , antiderivative size = 1271, normalized size of antiderivative = 1.58

method result size
derivativedivides \(\text {Expression too large to display}\) \(1271\)
default \(\text {Expression too large to display}\) \(1271\)
norman \(\text {Expression too large to display}\) \(2076\)
parallelrisch \(\text {Expression too large to display}\) \(6687\)
risch \(\text {Expression too large to display}\) \(6825\)

input
int((a+b*tan(f*x+e))^3*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e))^3, 
x,method=_RETURNVERBOSE)
 
output
1/f*(tan(f*x+e)*C*b^3/d^3+1/(c^2+d^2)^3*(1/2*(-3*A*a^3*c^2*d+A*a^3*d^3+3*A 
*a^2*b*c^3-9*A*a^2*b*c*d^2+9*A*a*b^2*c^2*d-3*A*a*b^2*d^3-A*b^3*c^3+3*A*b^3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*c^3*d^3-2*C*a^3*c*d^5+3*C*a^2*b*c^4 
*d^2+9*C*a^2*b*c^2*d^4-6*C*a*b^2*c^5*d-12*C*a*b^2*c^3*d^3+3*C*b^3*c^6+5*C* 
b^3*c^4*d^2)/(c^2+d^2)^2/(c+d*tan(f*x+e))+1/d^4*(3*A*a^3*c^2*d^5-A*a^3*d^7 
-3*A*a^2*b*c^3*d^4+9*A*a^2*b*c*d^6-9*A*a*b^2*c^2*d^5+3*A*a*b^2*d^7+A*b^3*c 
^3*d^4-3*A*b^3*c*d^6-B*a^3*c^3*d^4+3*B*a^3*c*d^6-9*B*a^2*b*c^2*d^5+3*B*...
 
3.1.84.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 2490 vs. \(2 (797) = 1594\).

Time = 1.33 (sec) , antiderivative size = 2490, normalized size of antiderivative = 3.10 \[ \int \frac {(a+b \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^3} \, dx=\text {Too large to display} \]

input
integrate((a+b*tan(f*x+e))^3*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+ 
e))^3,x, algorithm="fricas")
 
output
-1/2*(3*C*b^3*c^7*d^2 + A*a^3*d^9 - (3*C*a*b^2 + B*b^3)*c^6*d^3 - (3*C*a^2 
*b + 3*B*a*b^2 + (A - 9*C)*b^3)*c^5*d^4 + (3*C*a^3 + 9*B*a^2*b + 3*(3*A - 
7*C)*a*b^2 - 7*B*b^3)*c^4*d^5 - 5*(B*a^3 + 3*(A - C)*a^2*b - 3*B*a*b^2 - A 
*b^3)*c^3*d^6 + ((7*A - 3*C)*a^3 - 9*B*a^2*b - 9*A*a*b^2)*c^2*d^7 + (B*a^3 
 + 3*A*a^2*b)*c*d^8 - 2*(C*b^3*c^6*d^3 + 3*C*b^3*c^4*d^5 + 3*C*b^3*c^2*d^7 
 + C*b^3*d^9)*tan(f*x + e)^3 - 2*(((A - C)*a^3 - 3*B*a^2*b - 3*(A - C)*a*b 
^2 + B*b^3)*c^5*d^4 + 3*(B*a^3 + 3*(A - C)*a^2*b - 3*B*a*b^2 - (A - C)*b^3 
)*c^4*d^5 - 3*((A - C)*a^3 - 3*B*a^2*b - 3*(A - C)*a*b^2 + B*b^3)*c^3*d^6 
- (B*a^3 + 3*(A - C)*a^2*b - 3*B*a*b^2 - (A - C)*b^3)*c^2*d^7)*f*x - (9*C* 
b^3*c^7*d^2 - A*a^3*d^9 - 3*(3*C*a*b^2 + B*b^3)*c^6*d^3 + (3*C*a^2*b + 3*B 
*a*b^2 + (A + 23*C)*b^3)*c^5*d^4 + (C*a^3 + 3*B*a^2*b + 3*(A - 9*C)*a*b^2 
- 9*B*b^3)*c^4*d^5 - (3*B*a^3 + 3*(3*A - 7*C)*a^2*b - 21*B*a*b^2 - (7*A + 
12*C)*b^3)*c^3*d^6 + 5*((A - C)*a^3 - 3*B*a^2*b - 3*A*a*b^2)*c^2*d^7 + (3* 
B*a^3 + 9*A*a^2*b + 4*C*b^3)*c*d^8 + 2*(((A - C)*a^3 - 3*B*a^2*b - 3*(A - 
C)*a*b^2 + B*b^3)*c^3*d^6 + 3*(B*a^3 + 3*(A - C)*a^2*b - 3*B*a*b^2 - (A - 
C)*b^3)*c^2*d^7 - 3*((A - C)*a^3 - 3*B*a^2*b - 3*(A - C)*a*b^2 + B*b^3)*c* 
d^8 - (B*a^3 + 3*(A - C)*a^2*b - 3*B*a*b^2 - (A - C)*b^3)*d^9)*f*x)*tan(f* 
x + e)^2 + (3*C*b^3*c^9 + 9*C*b^3*c^7*d^2 - (3*C*a*b^2 + B*b^3)*c^8*d - 3* 
(3*C*a*b^2 + B*b^3)*c^6*d^3 + (B*a^3 + 3*(A - C)*a^2*b - 3*B*a*b^2 - (A - 
10*C)*b^3)*c^5*d^4 - 3*((A - C)*a^3 - 3*B*a^2*b - 3*(A - 2*C)*a*b^2 + 2...
 
3.1.84.6 Sympy [F(-2)]

Exception generated. \[ \int \frac {(a+b \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^3} \, dx=\text {Exception raised: AttributeError} \]

input
integrate((a+b*tan(f*x+e))**3*(A+B*tan(f*x+e)+C*tan(f*x+e)**2)/(c+d*tan(f* 
x+e))**3,x)
 
output
Exception raised: AttributeError >> 'NoneType' object has no attribute 'pr 
imitive'
 
3.1.84.7 Maxima [A] (verification not implemented)

Time = 0.37 (sec) , antiderivative size = 1110, normalized size of antiderivative = 1.38 \[ \int \frac {(a+b \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^3} \, dx=\text {Too large to display} \]

input
integrate((a+b*tan(f*x+e))^3*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+ 
e))^3,x, algorithm="maxima")
 
output
1/2*(2*C*b^3*tan(f*x + e)/d^3 + 2*(((A - C)*a^3 - 3*B*a^2*b - 3*(A - C)*a* 
b^2 + B*b^3)*c^3 + 3*(B*a^3 + 3*(A - C)*a^2*b - 3*B*a*b^2 - (A - C)*b^3)*c 
^2*d - 3*((A - C)*a^3 - 3*B*a^2*b - 3*(A - C)*a*b^2 + B*b^3)*c*d^2 - (B*a^ 
3 + 3*(A - C)*a^2*b - 3*B*a*b^2 - (A - C)*b^3)*d^3)*(f*x + e)/(c^6 + 3*c^4 
*d^2 + 3*c^2*d^4 + d^6) - 2*(3*C*b^3*c^7 + 9*C*b^3*c^5*d^2 - (3*C*a*b^2 + 
B*b^3)*c^6*d - 3*(3*C*a*b^2 + B*b^3)*c^4*d^3 + (B*a^3 + 3*(A - C)*a^2*b - 
3*B*a*b^2 - (A - 10*C)*b^3)*c^3*d^4 - 3*((A - C)*a^3 - 3*B*a^2*b - 3*(A - 
2*C)*a*b^2 + 2*B*b^3)*c^2*d^5 - 3*(B*a^3 + 3*(A - C)*a^2*b - 3*B*a*b^2 - A 
*b^3)*c*d^6 + ((A - C)*a^3 - 3*B*a^2*b - 3*A*a*b^2)*d^7)*log(d*tan(f*x + e 
) + c)/(c^6*d^4 + 3*c^4*d^6 + 3*c^2*d^8 + d^10) + ((B*a^3 + 3*(A - C)*a^2* 
b - 3*B*a*b^2 - (A - C)*b^3)*c^3 - 3*((A - C)*a^3 - 3*B*a^2*b - 3*(A - C)* 
a*b^2 + B*b^3)*c^2*d - 3*(B*a^3 + 3*(A - C)*a^2*b - 3*B*a*b^2 - (A - C)*b^ 
3)*c*d^2 + ((A - C)*a^3 - 3*B*a^2*b - 3*(A - C)*a*b^2 + B*b^3)*d^3)*log(ta 
n(f*x + e)^2 + 1)/(c^6 + 3*c^4*d^2 + 3*c^2*d^4 + d^6) - (5*C*b^3*c^7 + A*a 
^3*d^7 - 3*(3*C*a*b^2 + B*b^3)*c^6*d + (3*C*a^2*b + 3*B*a*b^2 + (A + 9*C)* 
b^3)*c^5*d^2 + (C*a^3 + 3*B*a^2*b + 3*(A - 7*C)*a*b^2 - 7*B*b^3)*c^4*d^3 - 
 (3*B*a^3 + 3*(3*A - 5*C)*a^2*b - 15*B*a*b^2 - 5*A*b^3)*c^3*d^4 + ((5*A - 
3*C)*a^3 - 9*B*a^2*b - 9*A*a*b^2)*c^2*d^5 + (B*a^3 + 3*A*a^2*b)*c*d^6 + 2* 
(3*C*b^3*c^6*d - 2*(3*C*a*b^2 + B*b^3)*c^5*d^2 + (3*C*a^2*b + 3*B*a*b^2 + 
(A + 5*C)*b^3)*c^4*d^3 - 4*(3*C*a*b^2 + B*b^3)*c^3*d^4 - (B*a^3 + 3*(A ...
 
3.1.84.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 2441 vs. \(2 (797) = 1594\).

Time = 1.39 (sec) , antiderivative size = 2441, normalized size of antiderivative = 3.04 \[ \int \frac {(a+b \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^3} \, dx=\text {Too large to display} \]

input
integr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C*a*b 
^2*c^4*d^3 - 3*B*b^3*c^4*d^3 + B*a^3*c^3*d^4 + 3*A*a^2*b*c^3*d^4 - 3*C*a^2 
*b*c^3*d^4 - 3*B*a*b^2*c^3*d^4 - A*b^3*c^3*d^4 + 10*C*b^3*c^3*d^4 - 3*A*a^ 
3*c^2*d^5 + 3*C*a^3*c^2*d^5 + 9*B*a^2*b*c^2*d^5 + 9*A*a*b^2*c^2*d^5 - 18*C 
*a*b^2*c^2*d^5 - 6*B*b^3*c^2*d^5 - 3*B*a^3*c*d^6 - 9*A*a^2*b*c*d^6 + 9*C*a 
^2*b*c*d^6 + 9*B*a*b^2*c*d^6 + 3*A*b^3*c*d^6 + A*a^3*d^7 - C*a^3*d^7 - 3*B 
*a^2*b*d^7 - 3*A*a*b^2*d^7)*log(abs(d*tan(f*x + e) + c))/(c^6*d^4 + 3*c^4* 
d^6 + 3*c^2*d^8 + d^10) + (9*C*b^3*c^7*d^2*tan(f*x + e)^2 - 9*C*a*b^2*c...
 
3.1.84.9 Mupad [B] (verification not implemented)

Time = 18.17 (sec) , antiderivative size = 1172, normalized size of antiderivative = 1.46 \[ \int \frac {(a+b \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^3} \, dx=\frac {\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (d^3\,\left (3\,B\,b^3\,c^4+9\,C\,a\,b^2\,c^4\right )-d^6\,\left (3\,A\,b^3\,c-3\,B\,a^3\,c-9\,A\,a^2\,b\,c+9\,B\,a\,b^2\,c+9\,C\,a^2\,b\,c\right )+d^5\,\left (3\,A\,a^3\,c^2+6\,B\,b^3\,c^2-3\,C\,a^3\,c^2-9\,A\,a\,b^2\,c^2-9\,B\,a^2\,b\,c^2+18\,C\,a\,b^2\,c^2\right )+d^4\,\left (A\,b^3\,c^3-B\,a^3\,c^3-10\,C\,b^3\,c^3-3\,A\,a^2\,b\,c^3+3\,B\,a\,b^2\,c^3+3\,C\,a^2\,b\,c^3\right )+d^7\,\left (C\,a^3-A\,a^3+3\,A\,a\,b^2+3\,B\,a^2\,b\right )+d\,\left (B\,b^3\,c^6+3\,C\,a\,b^2\,c^6\right )-3\,C\,b^3\,c^7-9\,C\,b^3\,c^5\,d^2\right )}{f\,\left (c^6\,d^4+3\,c^4\,d^6+3\,c^2\,d^8+d^{10}\right )}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (A\,a^3+A\,b^3\,1{}\mathrm {i}-B\,a^3\,1{}\mathrm {i}+B\,b^3-C\,a^3-C\,b^3\,1{}\mathrm {i}-3\,A\,a\,b^2-A\,a^2\,b\,3{}\mathrm {i}+B\,a\,b^2\,3{}\mathrm {i}-3\,B\,a^2\,b+3\,C\,a\,b^2+C\,a^2\,b\,3{}\mathrm {i}\right )}{2\,f\,\left (-c^3\,1{}\mathrm {i}-3\,c^2\,d+c\,d^2\,3{}\mathrm {i}+d^3\right )}-\frac {\frac {A\,a^3\,d^7+5\,C\,b^3\,c^7+B\,a^3\,c\,d^6-3\,B\,b^3\,c^6\,d+5\,A\,a^3\,c^2\,d^5+5\,A\,b^3\,c^3\,d^4+A\,b^3\,c^5\,d^2-3\,B\,a^3\,c^3\,d^4-7\,B\,b^3\,c^4\,d^3-3\,C\,a^3\,c^2\,d^5+C\,a^3\,c^4\,d^3+9\,C\,b^3\,c^5\,d^2-9\,A\,a\,b^2\,c^2\,d^5+3\,A\,a\,b^2\,c^4\,d^3-9\,A\,a^2\,b\,c^3\,d^4+15\,B\,a\,b^2\,c^3\,d^4+3\,B\,a\,b^2\,c^5\,d^2-9\,B\,a^2\,b\,c^2\,d^5+3\,B\,a^2\,b\,c^4\,d^3-21\,C\,a\,b^2\,c^4\,d^3+15\,C\,a^2\,b\,c^3\,d^4+3\,C\,a^2\,b\,c^5\,d^2+3\,A\,a^2\,b\,c\,d^6-9\,C\,a\,b^2\,c^6\,d}{2\,d\,\left (c^4+2\,c^2\,d^2+d^4\right )}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (B\,a^3\,d^6+3\,C\,b^3\,c^6+3\,A\,a^2\,b\,d^6+2\,A\,a^3\,c\,d^5-2\,B\,b^3\,c^5\,d-2\,C\,a^3\,c\,d^5+3\,A\,b^3\,c^2\,d^4+A\,b^3\,c^4\,d^2-B\,a^3\,c^2\,d^4-4\,B\,b^3\,c^3\,d^3+5\,C\,b^3\,c^4\,d^2-3\,A\,a^2\,b\,c^2\,d^4+9\,B\,a\,b^2\,c^2\,d^4+3\,B\,a\,b^2\,c^4\,d^2-12\,C\,a\,b^2\,c^3\,d^3+9\,C\,a^2\,b\,c^2\,d^4+3\,C\,a^2\,b\,c^4\,d^2-6\,A\,a\,b^2\,c\,d^5-6\,B\,a^2\,b\,c\,d^5-6\,C\,a\,b^2\,c^5\,d\right )}{c^4+2\,c^2\,d^2+d^4}}{f\,\left (c^2\,d^3+2\,c\,d^4\,\mathrm {tan}\left (e+f\,x\right )+d^5\,{\mathrm {tan}\left (e+f\,x\right )}^2\right )}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (A\,b^3-B\,a^3-C\,b^3-3\,A\,a^2\,b+3\,B\,a\,b^2+3\,C\,a^2\,b+A\,a^3\,1{}\mathrm {i}+B\,b^3\,1{}\mathrm {i}-C\,a^3\,1{}\mathrm {i}-A\,a\,b^2\,3{}\mathrm {i}-B\,a^2\,b\,3{}\mathrm {i}+C\,a\,b^2\,3{}\mathrm {i}\right )}{2\,f\,\left (-c^3-c^2\,d\,3{}\mathrm {i}+3\,c\,d^2+d^3\,1{}\mathrm {i}\right )}+\frac {C\,b^3\,\mathrm {tan}\left (e+f\,x\right )}{d^3\,f} \]

input
int(((a + b*tan(e + f*x))^3*(A + B*tan(e + f*x) + C*tan(e + f*x)^2))/(c + 
d*tan(e + f*x))^3,x)
 
output
(log(tan(e + f*x) + 1i)*(A*a^3 + A*b^3*1i - B*a^3*1i + B*b^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